<template>
    <div>
<h1>添加分类</h1>
<p>分类名称：<input type="text" v-model="name"></p>
<p><button @click="addcate">添加</button></p>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    data() {
        return {
            name:'',
            base_url:'http://127.0.0.1:8000/'
        }
    },
    methods: {
        addcate() {
            let fdata=new FormData()
            fdata.append('name',this.name)
            axios({
                url:this.base_url+'app01/addcate/',
                method:'post',
                data:fdata
            }).then(resp=>{
                console.log(resp.data)
            })
        }
    },
    created() {

    }
}
</script>

<style scoped>

</style>
